﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using ZX.Web.UI.Controls;
using ZX.BLL;
using ZX.SYS.Library;
using ZX.EHR.Library;
using ZX.Web.UI.Controls.ControlBind;

namespace ZX.WebApp.EditWidows.OrganizationalManager
{
    public partial class AddDutyGrade : EditUIPage
    {
        BDatPhraseDetail bllDetail = new BDatPhraseDetail();
        BDutyInfo bllInfo = new BDutyInfo();
        private string strEntity = "", strDutyId = "", strName = "";

        protected void Page_Load(object sender, EventArgs e)
        {
            strDutyId = this.GetStringFromQueryString("id", "");
            strEntity = this.GetStringFromQueryString("entity", "");
            strName = this.GetStringFromQueryString("name","");

            IList<DatPhraseDetail> ListDetail = bllDetail.GetDatPhraseDetailByClassValue("DutyGrade");
            DropDownListControl.DropDataSourceBind(this.DutyGradeId, ListDetail, "PhraseText", "PhraseID");
            if (strDutyId != "") {
                this.PostID.Value = strDutyId;
                this.Name.Text = strName;
            }

            /*DatDutyInfo dutyInfo = bllInfo.GetDatDutyInfoById(new Guid(strDutyId));
            if (dutyInfo != null)
            {
                this.PostID.Value = dutyInfo.ID.ToString();
                this.Name.Text = dutyInfo.Name;
            }*/

            //有数据则显示 修改
            IList<DatPostDutygrade> ListInfo = bllInfo.GetDatDutyInfoAndDutyGradeByDutyInfoId(new Guid(strDutyId));
            if (ListInfo != null && ListInfo.Count > 0)
            {
                DropDownListControl.DropDownListSelect(this.DutyGradeId, ListInfo[0].DutyGradeId.ToString());
                this.ID.Value = ListInfo[0].ID.ToString();
            }
        }
        public string EntityNames
        { get { return this.strEntity; } }
        public string DutyId
        { get { return this.strDutyId; } }
    }
}